package com.starsea.book.ui.newpage.pop

import android.content.Context
import android.widget.FrameLayout
import com.lxj.xpopup.core.CenterPopupView
import com.starsea.book.R
import com.starsea.book.ui.newpage.normalview.RadiusLinearLayout
import com.starsea.book.ui.newpage.normalview.RadiusTextView
import com.starsea.book.ui.newpage.utils.finialDouble
import com.starsea.book.utils.gone
import com.starsea.book.utils.visible

/**
 * @author Lee
 * @createTime 2023-08-04 16 GMT+8
 * @desc : 补签
 */
class LotteryTiggerPrizePop(
    var mContext: Context,
    var coin: Double = 0.0,
    var cash: Double = 0.0,
) :
    CenterPopupView(mContext) {

    lateinit var rtv_coin: RadiusTextView
    lateinit var fl_add: FrameLayout
    lateinit var rtv_cash: RadiusTextView
    lateinit var rll_confim: RadiusLinearLayout


    override fun getImplLayoutId(): Int {
        return R.layout.layout_lottery_tigger_prize_pop
    }

    override fun onCreate() {
        super.onCreate()

        rtv_coin = findViewById(R.id.rtv_coin)
        fl_add = findViewById(R.id.fl_add)
        rtv_cash = findViewById(R.id.rtv_cash)
        rll_confim = findViewById(R.id.rll_confim)

        rtv_coin.text = "${coin.finialDouble()}金币"
        rtv_cash.text = "${cash.finialDouble()}天"

        if (coin.finialDouble() != "0" && cash.finialDouble() != "0") {
            rtv_coin.visible()
            fl_add.visible()
            rtv_cash.visible()
        } else {
            if (coin.finialDouble() != "0" && cash.finialDouble() == "0") {
                rtv_coin.visible()
                fl_add.gone()
                rtv_cash.gone()
            } else if (coin.finialDouble() == "0" && cash
                    .finialDouble() != "0"
            ) {
                rtv_coin.gone()
                fl_add.gone()
                rtv_cash.visible()
            }
        }


        rll_confim.setOnClickListener {

            dismiss()
        }

    }


}